<?php

namespace App\Admin\Controllers;

use App\Http\Controllers\Controller;
use Encore\Admin\Controllers\Dashboard;
use Encore\Admin\Layout\Column;
use Encore\Admin\Layout\Content;
use Encore\Admin\Layout\Row;
use Encore\Admin\Widgets\Table;
use Illuminate\Http\Request;

class ApiImitateController extends Controller
{
    public function unicome(Content $content, Request $request)
    {
        if ($request->isMethod('post')) {
        } else {

            return $content
                ->title('工作台')
                ->description('&nbsp;')
                ->view('admin.api_imitate.unicome', [
                    'apis' => [
                        [
                            'name' => 'api/users',
                            'url' => 'api/world/cities',
                            'method' => 'GET',
                            'color' => 'green',
                            'parameters' => json_encode([
                                [
                                    'name' => 'name',
                                    'defaultValue' => 'superwen',
                                    'description' => '',
                                    'required' => true,
                                    'type' => 'text'
                                ],
                                [
                                    'name' => 'password',
                                    'defaultValue' => '',
                                    'description' => '',
                                    'required' => true,
                                    'type' => 'password'
                                ]
                            ]),
                        ]
                    ]
                ]);
        }
    }

    public function suning(Content $content)
    {
    }

    public function handle(Request $request)
    {
        return response()->json([
            'status' => true,
            'message' => 'success',
            'data' => [
                'content' => '<b>html5teset</b>',
                'headers' => '',
                'cookies' => ''
            ]
        ]);
    }
}
